package qlsl.androiddesign.adapter.subadapter;

import java.util.List;

import com.qlsl.androiddesign.kuaiwa.R;

import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import qlsl.androiddesign.activity.baseactivity.BaseActivity;
import qlsl.androiddesign.adapter.baseadapter.BaseAdapter;
import qlsl.androiddesign.entity.otherentity.Trailer;
import qlsl.androiddesign.util.commonutil.ImageUtils;

public class TrailerAdapter extends BaseAdapter<Trailer> {

	public TrailerAdapter(BaseActivity activity, List<Trailer> list) {
		super(activity, list);
	}

	public View getView(int position, View convertView, ViewGroup parent) {
		convertView = getItemView(convertView, R.layout.listitem_trailer);

		ImageView iv_icon = getView(convertView, R.id.iv_icon);
		TextView tv_name = getView(convertView, R.id.tv_name);
		TextView tv_info = getView(convertView, R.id.tv_info);
		TextView tv_price = getView(convertView, R.id.tv_price);
		TextView tv_time = getView(convertView, R.id.tv_time);

		Trailer item = getItem(position);
		String single = activity.getString(R.string.single);

		String name = item.getBossname();
		String address = "" + item.getAddress();
		String info = "业务:" + single + item.getServertype();
		String time = item.getDistancestr();

		ImageUtils.roundTop(activity, item.getPhoto(), iv_icon);
		tv_name.setText(name);
		tv_info.setText(info);
		/*
		 * TextSizeUtils.setText(tv_price, price, 3, price.length(), 14,
		 * activity .getResources().getColor(R.color.half_red));
		 */
		tv_time.setText("距离:"+time);
		tv_price.setText("地址:" + single + address);

		return convertView;
	}
}
